home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / textfile / gem_bgm / gem_bgm.txt < prev   
Text File  |  1995-04-27  |  9KB  |  179 lines

  1. Secrets of Atari hard-disk partitions
  2.  
  3. By Al Fasoldt
  4.  
  5. Copyright (c) 1994 by Al Fasoldt. All rights reserved.
  6.  
  7.  
  8. When Atari laid out the way hard disks should operate with the ST in
  9. 1985, it choose to stick with the method already in use for PCs at
  10. that time. This was a wise choice. The PC disk format was widely
  11. understood and easy to work with. PC standards have changed in the
  12. ensuing decade, and so have the standards used by Atari computers.
  13. But the basic operation of a hard drive attached to an ST, TT, STacy
  14. or Falcon should present no problem to anyone familiar with servicing
  15. or setting up PC hard disks.
  16.  
  17. All hard disks that work with Atari's so-called 16/32-bit computers
  18. (or "Sixteen/Thirtytwo" -- "ST") use 512-byte sectors. This is true no
  19. matter how large the hard disk is. Let's back up a little and take a
  20. look at the way disks store information.
  21.  
  22. To make disk storage fast and efficient, files of any size are
  23. divided into chunks called clusters when they are stored on disk. An
  24. ASCII text file consisting only of the letter "A" is one byte long in
  25. your computer's word processor, but it takes up much more space than
  26. that when it is stored on disk. Because the smallest storage space on
  27. a hard disk is a cluster, that single-byte file occupies an entire
  28. cluster on the disk. (The "A" would appear at the start of the
  29. cluster, but the rest of the bytes in the cluster would be so-called
  30. null characters -- characters that don't mean anything.)
  31.  
  32. How big is a cluster? Normally, a cluster is two sectors long. So
  33. that means every file takes up at least 1,024 bytes (512 bytes X 2).
  34. This gets a little complicated when large drives are used. An
  35. explanation of how a single disk drive can appear to be many drives
  36. should help.
  37.  
  38. For a number of technical reasons, a hard drive often works better
  39. when the computer deals with it in sections. These are called
  40. partitions. All computers of any kind make use of this technique. The
  41. drive is partitioned into two or more semi-independent areas that the
  42. computer sees as separate drives. (The computer has no way of knowing
  43. if Drive C: and Drive D: are physically separate or not.)
  44.  
  45. One advantage of partitioning a drive is found in the way the
  46. computer deals with sectors. It's just plain impossible for a modern
  47. Atari to handle more than a finite number of sectors on each drive.
  48. (Don't blame Atari for this. Every computer has a limit.) For older
  49. Ataris using versions of The Operating System (TOS) prior to 1.04,
  50. the sector limit is 32,768. Newer models, with later TOS
  51. versions, have a sector limit of 65,536. If you do some simple
  52. mathematics, you'll see how this limit comes into action: No matter
  53. how large the hard disk is, the computer will only be able to work
  54. with either 16 megabytes or 32 megabytes, depending on the TOS
  55. version. (Here's the math: A limit of 32,768 sectors multiplied by
  56. 512 bytes per sector equals 16,777,216 bytes. That's exactly 16
  57. megabytes the way computers count, and the other calculation yields
  58. exactly 32 megabytes.)
  59.  
  60. What's this mean? To put it simply, TOS forces all of us to use
  61. partitioned hard drives if our hard disks are larger than a certain
  62. size. Actually, I'm not telling the whole story. There is a way
  63. (which I will explain shortly) to fool TOS into letting partitions
  64. get a lot bigger, but they can't be any size; there is still a limit.
  65.  
  66. So if you're planning on replacing a small hard disk with a larger
  67. one -- one that holds 120 megabytes, for example -- you'll have to
  68. make a choice: Partition it into at least three separate drives or
  69. fool TOS into thinking the drive has no more than 65,536 sectors
  70. (taking it for granted that you are using a modern version of TOS).
  71.  
  72. If you stick with the normal TOS method, you'll be using GEM
  73. partitions. These have 512 bytes per sector and two sectors per
  74. cluster. (GEM stands for Graphics Environment Manager, which has
  75. nothing to do with a hard disk, but that's the name these partitions
  76. were given.)
  77.  
  78. If you want to make larger partitions -- ones that are bigger than
  79. GEM sizes -- you'll need to choose BGM ("Big GEM") partitions. These
  80. can contain many more sectors, but the actual sector count is not
  81. disclosed to TOS. As far as TOS knows, the partition ALWAYS has
  82. 65,536 sectors or less. As in GEM partitions, clusters are two
  83. sectors long.
  84.  
  85. TOS is kept in the dark by a technique that uses logical sectors.
  86. Each logical sector is made up of many physical sectors. What TOS is
  87. told is the number of logical sectors, not physical sectors. The
  88. scheme works quite well. Some very old programs don't run properly
  89. when your drive uses these larger BGM partitions, but most modern
  90. programs have no problem with them.
  91.  
  92. BGM partitions can be as large as 512 megabytes. This is wonderful,
  93. right? Well, not really. While it's great to be able to hang a
  94. 512-megabyte drive onto your computer and treat the entire disk as
  95. Drive C:, you sacrifice two things. One is generally acknowledged and
  96. the other is not.
  97.  
  98. The first sacrifice is efficiency. In order to get TOS to go along
  99. with a 512-megabyte partition, the hard-drive software bunches up
  100. eight sectors and reports them as a single sector to TOS. Two of those
  101. large logical sectors are then stuck together into a cluster.
  102. Remember, the smallest unit of disk storage is a cluster. So that
  103. cluster contains 16 sectors. Doing some math, we can see that the
  104. smallest unit of storage on a 512-megabyte partition is 16,384 bytes
  105. (512 bytes X 16 X 2). This means every file, no matter how small, will
  106. take up at least 16,384 bytes of space on the drive.
  107.  
  108. That probably seems like a lot of wasted space for all the small
  109. files on your drive. But it's even worse than it seems. EVERY file is
  110. likely to be affected. On average, the last cluster of space for each
  111. file is only half used, so the average amount of wasted space --
  112. called slack space -- is half the size of one cluster. On a
  113. 512-megabyte partition, this slack space amounts to 8 kilobytes per
  114. file. If the drive holds 1,000 files, the total slack space is 8
  115. megabytes.
  116.  
  117. Folders are a special case. They are actually files that contain
  118. references to other files. Because they are files, they take up one
  119. cluster of space on a drive. The more folders you have, the more
  120. space is wasted on a BGM partition. On my main storage system, I have
  121. more than 1,000 folders, each one of them "empty." (Folders are
  122. always shown as empty in a directory listing.) They take up 16
  123. megabytes of space -- hardly anybody's definition of "empty"!
  124.  
  125. The second sacrifice is seldom mentioned. One reason for using a much
  126. larger hard disk is to store more files. (This makes sense, right?)
  127. But you cannot, strictly speaking, store more files on a large
  128. partition than you can on a small one.
  129.  
  130. Say that again? You heard it right. A large disk partition cannot
  131. store more files than a small one because each file takes up at least
  132. one cluster, no matter how large or small the disk is, and the number
  133. of clusters is fixed. On an Atari computer with a modern version of
  134. TOS, no hard disk partition can hold more than 32,768 files. To
  135. accomplish this, each file would have to be no larger than a single
  136. cluster (two sectors). In reality, the limit is a little less than
  137. this, because some of the clusters are reserved for use by the drive
  138. itself, and others must be used for folders. (A partition with no
  139. folders can hold only a few hundred files, because the root directory
  140. is a fixed size.)
  141.  
  142. This is more trivia than anything else, since no one is likely to try
  143. to store 32,000 1,024-byte files on a disk. But the facts are clear:
  144. A large partition cannot store more files than a small partition if
  145. the files are all small.
  146.  
  147. Here is how much space a single file takes up on a disk (in other
  148. words, this shows the cluster size), even if the file is only a few
  149. bytes in length, assuming a TOS version of at least 1.04:
  150.  
  151. GEM partition, maximum size of 32 megabytes: 1,024 bytes.
  152.  
  153. BGM partition, maximum 64 megabytes: 2,048 bytes.
  154.  
  155. BGM partition, maximum 128 megabytes: 4,096 bytes.
  156.  
  157. BGM partition, maximum 256 megabytes: 8,192 bytes.
  158.  
  159. BGM partition, maximum 512 megabytes: 16,384 bytes.
  160.  
  161.  
  162. The lesson here is to weigh the advantages and disadvantages of BGM
  163. partitions before choosing one or the other. BGM partitions make
  164. everything easy: You need to deal with a minimum number of drive
  165. partitions, and disk operations are often faster. (Moving a file from
  166. one folder to another on the same partition is done very quickly,
  167. since all the operating system does is rewrite the pathname from one
  168. entry to another.) But they also waste space. Hard disks are cheaper
  169. than ever, and that wasted space doesn't cost much in dollars. But it
  170. does seem like an unnecessary loss of space otherwise, especially
  171. considering the increasing slack space as partitions grow.
  172.  
  173.  
  174. (This document cannot be printed or republished in any form without
  175. the express consent of the author. Al Fasoldt is Systems Editor of
  176. the Syracuse Newspapers in Syracuse, New York, and author of a
  177. syndicated newspaper column on computers and technology. He can be
  178. reached at this Internet address: a.fasoldt@genie.geis.com.)
  179.